package com.recSystem.Controller;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.recSystem.Entity.DTO.AuthorNetDTO;
import com.recSystem.Entity.DTO.Param.AuthorInfoParam;
import com.recSystem.Entity.POJO.HttpResponse;
import com.recSystem.Service.AuthorService;
import io.swagger.v3.oas.annotations.Operation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/author")
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class AuthorController {

    private final AuthorService authorService;

    public AuthorController(AuthorService authorService) {
        this.authorService = authorService;
    }

    private static final Logger log = LoggerFactory.getLogger(AuthorController.class);

    @PostMapping("/author_net")
    @Operation(summary = "获取作者合作网络")
    public HttpResponse<AuthorNetDTO> getAuthorNet(@RequestBody AuthorInfoParam param,
                                                   @RequestHeader(value = "Authorization") String token) {
        return authorService.getAuthorNet(param, token);
    }

}